# -*- coding: utf-8 -*-
"""
@Time ： 2024/3/28 23:11
@Auth ： fcq
@File ：process_VAST.py
@IDE ：PyCharm
@Motto：ABC(Always Be Coding)
"""

import pandas as pd
import json

def process(data_path):
    data = pd.read_csv(data_path, encoding='utf-8')
    data_list = []
    for idx, row in data.iterrows():
        data_dict = {
            'text':row['post'],
            'target':row['topic_str'],
            'label':row['label'],
            'seen':row['seen?']

        }
        data_list.append(data_dict)
    with open(data_path+".json", 'w', encoding='utf-8') as f:
        json.dump(data_list, f, ensure_ascii=False)


if __name__ == '__main__':
    process('../VAST/vast_train.csv')
    process('../VAST/vast_test.csv')
    process('../VAST/vast_dev.csv')